<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>供应商列表</title>
    <link href="<%=path%>/css/core.css" rel="stylesheet" type="text/css"/>
    <link href="<%=path%>/css/pagination.css" rel="stylesheet" type="text/css"/>
    <link href="<%=path%>/css/list.css" rel="stylesheet" type="text/css"/>
    <link href="<%=path%>/css/xToolbar.css" rel="stylesheet" type="text/css"/>
    <link href="<%=path%>/css/jquery-impromptu.css" rel="stylesheet" type="text/css"/>
  </head>
  <body>
  	<div id="toolbar"></div>
  	<form id="listForm" action="<%=path%>/purchase/supplier/listPagination.t4m" method="post">
      <table id="titleTable" cellpadding="0" cellspacing="0">
        <tr>
          <td>&nbsp;</td>
          <td><input type="checkbox" id="allBox"/></td>
          <td>编号</td>
          <td>供应商名称</td>
          <td>联系人</td>
          <td>电话</td>
          <td>移动电话</td>
          <td>E-mail</td>
          <td>客户类别</td>
          <td>地区</td>
        </tr>
      </table>
      <table id="dataTable" cellpadding="0" cellspacing="0">
        <s:iterator id="supplier" value="page.list" status="i">
          <tr class="row">
            <td class="num"><s:property value="#i.index+1"/></td>
            <td class="box">
              <input type="checkbox" name="idList" value="<s:property value="#supplier.id"/>"/>
            </td>
            <td><span><s:property value="#supplier.code"/></span></td>
            <td><span><s:property value="#supplier.name"/></span></td>
            <td><span><s:property value="#supplier.linkman"/></span></td>
            <td><span><s:property value="#supplier.phone"/></span></td>
            <td><span><s:property value="#supplier.mobile"/></span></td>
            <td><span><a href="mailto:<s:property value="#supplier.email"/>"><s:property value="#supplier.email"/></a></span></td>
            <td><span><s:property value="#supplier.type.name"/></span></td>
            <td><span><s:property value="#supplier.region.name"/></span></td>
          </tr>
        </s:iterator>
      </table>
      <s:include value="/share/pagebar.jsp"/>
  	</form>
    
    <script src="<%=path%>/js/core.js" type="text/javascript"></script>
    <script src="<%=path%>/js/share.js" type="text/javascript"></script>
    <script src="<%=path%>/js/jquery.js" type="text/javascript"></script>
    <script src="<%=path%>/js/Grid.js" type="text/javascript"></script>
    <script src="<%=path%>/js/BoxSelect.js" type="text/javascript"></script>
    <script src="<%=path%>/js/xToolbar.js" type="text/javascript"></script>
    <script src="<%=path%>/js/xToolbar.items.js" type="text/javascript"></script>
    <script src="<%=path%>/js/jquery-impromptu.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function(){
      
      new Toolbar({
        id: '1',
        renderTo : 'toolbar',
        icon: '../../image/op.gif',
        items : [{
          type:'button',
          text:'新建',
          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"supplier_new\")"/>',
          position: {
            a: '0px 0px',
            b: '0px -120px'
          },
          handler:function(){
            top.supplier.add();
          }
        },'-',{
          type : 'button',
          text : '修改',
          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"supplier_edit\")"/>',
          position: {
            a: '-20px 0px',
            b: '-20px -120px'
          },
          handler : function(){
            if(getFirstID()) {
                top.supplier.update(getFirstID());
            }
          }
        },'-',{
            type : 'button',
            text : '查看',
            position: {
                a: '-180px -60px',
                b: '-180px -180px'
            },
	          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"supplier_view\")"/>',
            handler : function(){
                if(getFirstID()) {
                    top.supplier.view(getFirstID());
                  }
            }
          },'-',{
	          type : 'button',
	          text : '删除',
	          position: {
	            a: '-40px 0px',
	            b: '-40px -120px'
	          },
	          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"supplier_delete\")"/>',
	          handler : function(){
	        	  if(getFirstID())
	              {
	                var txt = '是否删除该信息？';
	                $.prompt(txt,{
	                  buttons:{删除:true,取消:false},
	                  callback: function(v,m) {
	                    if(v) {
	                      document.getElementById('listForm').action = '<%=path%>/purchase/supplier/delete.t4m';
	                      document.getElementById('listForm').submit();
	                    }
	                  }
	                });
	              }
	          }
	        }]
      });
      
      new Grid({
        titleTable:'titleTable',
        dataTable:'dataTable',
        widths : [30,24,100,150,100,100,100,150,100,100,100],
        height : function(){return getGridHeight({toolbarId:'toolbar',hasPage:true});}
      });
      
      new BoxSelect({
        allId : 'allBox',
        boxName : 'idList'
      });
      
      loadReady();
    });
    </script>
  </body>
</html>